#if !defined( MATRIX_TRAITS_H)
#define  MATRIX_TRAITS_H
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <stdexcept>
// boost headers
#include <boost/lexical_cast.hpp>

namespace bcpp_matrix
{

template <typename T>
struct t_matrix_traits
{
	inline static std::string null_flag()  {return "10000";}
	inline static T binary_null()  {return static_cast<T>(10000);}
	inline static T from_string(const std::string& s)	{return boost::lexical_cast<T>(s);	}
	inline static T zero()	{return static_cast<T>(0U);}
};

template<>
struct t_matrix_traits<unsigned>
{
	inline static std::string null_flag()  {return "10000";}
	inline static unsigned binary_null()  {return 10000U;}
	inline static unsigned zero()	{return 0U;}
	inline static unsigned from_string(const std::string& s)
	{	char* endptr;
		return strtoul(s.c_str(), &endptr, 10);}
};
template<>
struct t_matrix_traits<int>
{
	inline static std::string null_flag()  {return "10000";}
	inline static int binary_null()  {return 10000;}
	inline static int from_string(const std::string& s)	{   return atol(s.c_str());}
	inline static int zero()	{return 0;}
};
template<>
struct t_matrix_traits<float>
{
	inline static std::string null_flag()  {return "10000";}
	inline static float binary_null()  {return 10000.0;}
	inline static float from_string(const std::string& s)	{return atof(s.c_str());	}
	inline static float zero()	{return 0.0F;}
};
template<>
struct t_matrix_traits<double>
{
	inline static std::string null_flag()  {return "10000";}
	inline static double binary_null()  {return 10000.0;}
	inline static double from_string(const std::string& s)	{return atof(s.c_str());	}
	inline static double zero()	{return 0.0;}
};

};

#endif	//MATRIX_TRAITS_H

